<?php echo $this->form;?>
<script>
$("#file").change(function(e){
    // get image
    var thisObj = $(this);
    var url = URL.createObjectURL(e.target.files[0]);
    var img = new Image();    
    var canvas = document.createElement("canvas");
    canvas.setAttribute("class","thumb");    
    var ctx = canvas.getContext('2d');
    img.onload = function() {
        var h = 100, per = img.width/img.height;
        var w = h*per;
        canvas.height = h;
        canvas.width = w;
        $(".thumb").remove();
        thisObj.parent().append("<br/>");
        thisObj.parent().append(canvas);
        ctx.drawImage(img, 0, 0,w ,h);    
    }
    img.src = url;   
});


</script>
